#!/usr/bin/python3
# -*- coding: utf-8 -*-

import logging, time

def log_cmd():
    # 创建控制台handler
    ch = logging.StreamHandler()
    ch.setLevel(logging.INFO)
    formatter = logging.Formatter(
        "%(asctime)s - %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s")
    ch.setFormatter(formatter)

    return ch

def set_logger():
    # 创建logger
    logger = logging.getLogger()
    logger.setLevel(logging.INFO)
    # 将logger添加到handler里面
    logger.addHandler(log_cmd())
